import { ApiProperty } from '@nestjs/swagger';
import {
  Column,
  CreateDateColumn,
  Entity,
  PrimaryGeneratedColumn,
  UpdateDateColumn,
} from 'typeorm';

@Entity()
export class BillingManagement {
  @ApiProperty({ type: Number, description: 'id' })
  @PrimaryGeneratedColumn()
  public id: number;

  @ApiProperty({ type: Number, description: '金额' })
  @Column({
    type: 'float',
    comment: '金额',
  })
  public money: number;

  @ApiProperty({ type: Date, description: '日期' })
  @Column({
    type: 'timestamp',
    comment: '日期',
  })
  public date_time: Date;

  @ApiProperty({ type: String, description: '类型' })
  @Column({
    type: 'varchar',
    comment: '类型',
  })
  public type: string;

  @ApiProperty({
    type: String,
    description: '备注',
  })
  @Column({
    type: 'text',
    comment: '备注',
    nullable: true,
  })
  public remark: string;

  @ApiProperty({ type: Date, description: '创建时间' })
  @CreateDateColumn({
    type: 'timestamp',
    comment: '创建时间',
    nullable: true,
  })
  public created_date: Date;

  @ApiProperty({
    type: String,
    description: '创建人',
  })
  @Column({
    type: 'varchar',
    length: 20,
    comment: '创建人',
    nullable: true,
  })
  public created_by: string;

  @ApiProperty({ type: Date, description: '更新时间' })
  @UpdateDateColumn({
    type: 'timestamp',
    comment: '更新时间',
    nullable: true,
  })
  public updated_date: Date;

  @ApiProperty({
    type: String,
    description: '更新人',
  })
  @Column({
    type: 'varchar',
    length: 20,
    comment: '更新人',
    nullable: true,
  })
  public updated_by: string;

  constructor(partial: Partial<BillingManagement>) {
    Object.assign(this, partial);
  }
}
